<form action="?module=pages&action=saveblock" method="post" id="block_properties">
    <input type="hidden" name="block[id]" id="block_id" value="{$block->id}">
    <input type="hidden" name="block[page_id]" id="block_page_id" value="{$block->page_id}">
    <input type="hidden" name="block[module_id]" id="block_module_id" value="{$block->module_id}">
    <input type="hidden" name="block[field]" id="block_field" value="{$block->field}">

    <h3>Свойства блока ({$block->Module->title})</h3>
    <table>
        <tr>
            <td>
                Выполнить действие:
            </td>
            <td>
                <select id="block_action" name="block[action]">
                    {foreach from=$block->Module->actions($block->field) item=action key=key}
                        <option value="{$key}" {if $block->action == $key}selected="selected"{/if}>{$action}</option>
                    {/foreach}
                </select>
            </td>
        </tr>
		<tr id="linked_page">
			<td>
				<label for="block_linked_page">Страница перехода:</label>
			</td>
			<td>
				{if count($block->Module->module->avaliableLinkedPages($block)) || $block->field == 0}
					{if !count($block->Module->module->avaliableLinkedPages($block))}
						<input type="hidden" id="block_linked_page" name="block[linked_page]" value="{$block->page_id}" /><div style="font-weight: bold">Текущая страница</div>
					{else}
						<select id="block_linked_page" name="block[linked_page]">
							{if $block->field == 0}<option{if $block->page_id == $block->linked_page} selected="selected"{/if} value="{$block->page_id}">Текущая страница</option>{/if}
							{foreach $block->Module->module->avaliableLinkedPages($block) as $page}
								<option{if $page->Page->id == $block->linked_page} selected="selected"{/if} value="{$page->Page->id}">{$page->Page->title}</option>
							{/foreach}
						</select>
					{/if}
				{else}
					<div style="color: red">Нет доступных страниц перехода</div>
				{/if}
			</td>
		</tr>
        <tr>
            <td style="color: #64A1D7" colspan="2">
                Свойства действия
            </td>
        </tr>
		<tr>
			<td colspan="2" id="actionProperties">
				{$block->Module->module->actionproperties($block)}
			</td>
		</tr>
		{if count($block->Module->module->avaliableTemplatesList($block->action, $block)) > 0}
			<tr>
				<td>
					<label for="block_tpl">Шаблон</label>
				</td>
				<td>
					<select id="block_tpl" name="block[tpl]">
						{foreach from=$block->Module->module->avaliableTemplatesList($block->action, $block) item=tpl}
							<option value="{$tpl}" {if $block->tpl == $tpl}selected="selected"{/if}>{$tpl}</option>
						{/foreach}
					</select>
				</td>
			</tr>
		{/if}
    </table>
    <div class="buttons"><input type="submit" value="Сохранить" class="save" /></div>
</form>